<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      Object.assign可以克隆一个对象产生一个一模一样的新对象，但是对内存地址不同
    
     */
    var obj = {
      name: '张三',
      age: 18
    }

    const obj2 = Object.assign({}, obj)

    // const obj2 = obj
    
    obj2.a = 1

    console.log(obj, obj2)

  var demo={
    name:'nana',
    age:21
  }
  const demo1= Object.assign({},demo)
  console.log(demo1)
  demo1.name='love'
  console.log(demo1)
  </script>
</body>
</html>